package com.fengye.algorithms.huawei.dp;

import java.util.Scanner;

/**
 * https://www.nowcoder.com/practice/e2a22f0305eb4f2f9846e7d644dba09b?tpId=37&tqId=21314&rp=1&ru=/exam/oj/ta&qru=/exam/oj/ta&sourceUrl=%2Fexam%2Foj%2Fta%3FtpId%3D37&difficulty=undefined&judgeStatus=undefined&tags=&title=
 * @Author fengye
 * @Date 2023/4/7 11:23
 **/
public class SquareSchemaMain {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            int m = in.nextInt();
            System.out.println(fun(n,m));
        }
    }

    public static int fun(int n, int m) {
        if(n==0 || m==0) {
            return 1;
        }
        /**
         * 最后一个的次数，都是有上面和左边次数相加的
         */
        return fun(n-1, m) + fun(n, m-1);
    }
}
